import java.util.ArrayList;

/**
 * Created by IntelliJ IDEA.
 * User: torstein
 * Date: 4/2/12
 * Time: 11:18 AM
 * To change this template use File | Settings | File Templates.
 */
public class Element {
    private boolean sign;
    private int quotient;
    private ArrayList<Arrow> arrows;

    /**
     *
     * @param sign Boolean True equals positive, False equals negative.
     * @param quotient Integer Should be 1 or more.
     * @param arrows ArrayList<Arrow> List of the arrows in the element.
     */
    public Element (boolean sign, int quotient, ArrayList<Arrow> arrows) {
        this.sign = sign;
        this.quotient = quotient;
        for (Arrow a : arrows) {
            this.arrows.add(a);
        }
    }
    
    public String toString () {
        String r = "";
        if (sign) {
            r = "+";
        } else {
            r = "-";
        }
        if (quotient != 1) {
            r += quotient;
        }
        for (Arrow a : arrows) {
            r += a.getName();
            r += "*";
        }
        if (r.charAt(r.length()-1) == '*') {
            r = r.substring(0,r.length()-2);
        }
        
        return r;
    }
}
